import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// 借用申请表
@Entity({ name: 'borrow' })
export class Borrow extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 借用申请编号
  @PrimaryColumn({
    type: 'varchar',
    name: 'borrowCode',
  })
  borrowCode: string

  // 申请人
  @Column({
    type: 'varchar',
    name: 'receivePerson',
  })
  receivePerson: string

  // 申请人id
  @Column({
    type: 'int',
    name: 'receivePersonId',
  })
  receivePersonId: number

  // 申请部门
  @Column({
    type: 'varchar',
    name: 'receiveBranch',
    nullable: true,
  })
  receiveBranch: string

  // 申请部门id
  @Column({
    type: 'int',
    name: 'receiveBranchId',
    nullable: true,
  })
  receiveBranchId: number

  // 借用名称
  @Column({
    type: 'varchar',
    name: 'borrowName',
  })
  borrowName: string

  // 借用类型 0 借入 1 借出
  // @Column({
  //   type: 'varchar',
  //   name: 'borrowType',
  // })
  // borrowType: string

  // 借入部门
  @Column({
    type: 'varchar',
    name: 'borrowInBranch',
  })
  borrowInBranch: string

  // 借入部门id
  @Column({
    type: 'int',
    name: 'borrowInBranchId',
    nullable: true,
  })
  borrowInBranchId: number

  // 借出部门
  @Column({
    type: 'varchar',
    name: 'borrowOutBranch',
  })
  borrowOutBranch: string

  // 借出部门id
  @Column({
    type: 'int',
    name: 'borrowOutBranchId',
    nullable: true,
  })
  borrowOutBranchId: number

  // 借入状态 0 进行中 1 驳回 2 同意
  @Column({
    type: 'varchar',
    name: 'borrowInStatus',
  })
  borrowInStatus: string

  // 借出状态 0 进行中 1 驳回 2 同意
  @Column({
    type: 'varchar',
    name: 'borrowOutStatus',
  })
  borrowOutStatus: string

  // 借用资产编码
  @Column({
    type: 'varchar',
    name: 'assetCode',
  })
  assetCode: string

  // 申请日期
  @Column({
    type: 'varchar',
    name: 'receiveDate',
  })
  receiveDate: string

  // 申请原因
  @Column({
    type: 'varchar',
    name: 'receiveReason',
  })
  receiveReason: string

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 借出批复
  @Column({
    type: 'varchar',
    name: 'outReason',
    nullable: true,
  })
  outReason: string

  // 借入批复
  @Column({
    type: 'varchar',
    name: 'inReason',
    nullable: true,
  })
  inReason: string

  // 借用日期
  @Column({
    type: 'varchar',
    name: 'borrowDate',
    nullable: true,
  })
  borrowDate: string

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
